function chooseFile() {
    document.getElementById('fileInput').click();
}

function uploadFile() {
    var fileInput = document.getElementById('fileInput');
    var file = fileInput.files[0];
    var formData = new FormData();
    formData.append('file', file);

    var xhr = new XMLHttpRequest();
    xhr.open('POST', 'http://localhost:8080/lo11?param2=classpath:static/index-background/', false); // 设置为false以同步发送请求
    xhr.onreadystatechange = function() {
        if (xhr.readyState === 4 && xhr.status === 200) {
            var statusDiv = document.getElementById('status');
            var statusDiv1 = document.getElementById('0');
            statusDiv.style.display = "block";
            statusDiv1.innerHTML = '文件上传成功！';


        } else if (xhr.readyState === 500) {
            var statusDiv = document.getElementById('status');
            var statusDiv1 = document.getElementById('0');
            statusDiv.style.display = "block";
            statusDiv1.innerHTML = '文件上传失败！';

        }
    };

    xhr.send(formData);
}